//
//  ByBonusOptimizeDetailCell.m
//  caipiao_ios
//
//  Created by mc on 2018/9/6.
//  Copyright © 2018年 ZhangZhanbin. All rights reserved.
//

#import "ByBonusOptimizeDetailCell.h"
#import "ByDocumentaryFourValue.h"

@implementation ByBonusOptimizeDetailCell

+ (instancetype)cellWithTableView:(UITableView*)tableView{
    
    static NSString *cellIdentifier = @"ByBonusOptimizeDetailCell";
    ByBonusOptimizeDetailCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
        self.contentView.backgroundColor = BY_BACKGROUND_COLOR;
        
        
    }
    return self;
}


- (void)initViews{
    
    [self.contentView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
    
    
    ByDocumentaryFourValue *titleView = [[ByDocumentaryFourValue alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40)];
    [self.contentView addSubview:titleView];
    titleView.valueLabel1.text = @"场次";
    titleView.valueLabel2.text = @"主队";
    titleView.valueLabel3.text = @"客队";
    titleView.valueLabel4.text = @"投注内容";
    titleView.backgroundColor = [UIColor colorWithHexString:@"#4D4D4D"];
    
    for (int i = 0; i < _netModel.count; i++) {
        ByNetModel *netModel = [_netModel.ball_infoArray objectAtIndex:i];
        ByDocumentaryFourValue *titleView = [[ByDocumentaryFourValue alloc] initWithFrame:CGRectMake(0, 40 + 40 * i, SCREEN_WIDTH, 40)];
        [self.contentView addSubview:titleView];
        titleView.backgroundColor = [UIColor colorWithHexString:@"#323332"];
        titleView.valueLabel1.text = netModel.num;
        titleView.valueLabel2.text = netModel.h_cn_abbr;
        titleView.valueLabel3.text = netModel.a_cn_abbr;
        titleView.valueLabel4.text = [NSString stringWithFormat:@"%@(%@)",netModel.title,netModel.valueString];
        
    }
    
    
}

- (void)setNetModel:(ByNetModel *)netModel{
    _netModel = netModel;
    [self initViews];
}

@end
